package org.open18.model;

import static javax.persistence.GenerationType.IDENTITY;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.validator.Length;
import org.hibernate.validator.NotNull;

/**
 * Facility generated by hbm2java
 */
@Entity
@Table(name = "FACILITY")
public class Facility implements java.io.Serializable {

	private Long id;
	private Member agent;
	private String name;
	private String description;
	private String type;
	private String address;
	private String city;
	private String state;
	private String zip;
	private String county;
	private String country;
	private String phone;
	private String uri;
	private Integer priceRange;
	private boolean drivingRange;
	private boolean proShop;
	private boolean rentsClubs;
	private boolean snackBar;
	private boolean restaurant;
	private Set<Course> courses = new HashSet<Course>(0);
	private byte[] logo;
	private String logoContentType;

	public Facility() {
	}

	public Facility(String name, String type, boolean drivingRange,
        boolean proShop, boolean rentsClubs, boolean snackBar,
        boolean restaurant) {
		this.name = name;
		this.type = type;
		this.drivingRange = drivingRange;
        this.proShop = proShop;
        this.rentsClubs = rentsClubs;
        this.snackBar = snackBar;
        this.restaurant = restaurant;
	}
	public Facility(String name, String description, String type,
			String address, String city, String state, String zip,
			String county, String country, String phone, String uri,
			Integer priceRange, boolean drivingRange,
            boolean proShop, boolean rentsClubs, boolean snackBar,
            boolean restaurant,	Set<Course> courses) {
		this.name = name;
		this.description = description;
		this.type = type;
		this.address = address;
		this.city = city;
		this.state = state;
		this.zip = zip;
		this.county = county;
		this.country = country;
		this.phone = phone;
		this.uri = uri;
		this.priceRange = priceRange;
		this.drivingRange = drivingRange;
		this.proShop = proShop;
		this.rentsClubs = rentsClubs;
		this.snackBar = snackBar;
		this.restaurant = restaurant;
		this.courses = courses;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "AGENT_ID")
	@NotNull
	public Member getAgent() {
		return this.agent;
	}

	public void setAgent(Member agent) {
		this.agent = agent;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "ID", unique = true, nullable = false)
	public Long getId() {
		return this.id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@Column(name = "NAME", nullable = false, length = 50)
	@NotNull
	@Length(max = 50)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "DESCRIPTION")
	public String getDescription() {
		return this.description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	@Column(name = "TYPE", nullable = false, length = 15)
	@NotNull
	@Length(max = 15)
	public String getType() {
		return this.type;
	}

	public void setType(String type) {
		this.type = type;
	}

	@Column(name = "ADDRESS", length = 50)
	@Length(max = 50)
	public String getAddress() {
		return this.address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	@Column(name = "CITY", length = 30)
	@Length(max = 30)
	public String getCity() {
		return this.city;
	}

	public void setCity(String city) {
		this.city = city;
	}

	@Column(name = "STATE", length = 2)
	@Length(max = 2)
	public String getState() {
		return this.state;
	}

	public void setState(String state) {
		this.state = state;
	}

	@Column(name = "ZIP", length = 5)
	@Length(max = 5)
	public String getZip() {
		return this.zip;
	}

	public void setZip(String zip) {
		this.zip = zip;
	}

	@Column(name = "COUNTY", length = 30)
	@Length(max = 30)
	public String getCounty() {
		return this.county;
	}

	public void setCounty(String county) {
		this.county = county;
	}

	@Column(name = "COUNTRY", length = 30)
	@Length(max = 30)
	public String getCountry() {
		return this.country;
	}

	public void setCountry(String country) {
		this.country = country;
	}

	@Column(name = "PHONE", length = 10)
	@Length(max = 10)
	public String getPhone() {
		return this.phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	@Column(name = "URI")
	public String getUri() {
		return this.uri;
	}

	public void setUri(String uri) {
		this.uri = uri;
	}

	@Column(name = "PRICE_RANGE")
	public Integer getPriceRange() {
		return this.priceRange;
	}

	public void setPriceRange(Integer priceRange) {
		this.priceRange = priceRange;
	}

	@Column(name = "DRIVING_RANGE", nullable = false)
	@NotNull
	public boolean isDrivingRange() {
		return this.drivingRange;
	}

	public void setDrivingRange(boolean drivingRange) {
		this.drivingRange = drivingRange;
	}

	@Column(name = "PRO_SHOP", nullable = false)
	@NotNull
	public boolean isProShop() {
		return this.proShop;
	}

	public void setProShop(boolean proShop) {
		this.proShop = proShop;
	}

	@Column(name = "RENTS_CLUBS", nullable = false)
	@NotNull
	public boolean isRentsClubs() {
		return this.rentsClubs;
	}

	public void setRentsClubs(boolean rentsClubs) {
		this.rentsClubs = rentsClubs;
	}

	@Column(name = "SNACK_BAR", nullable = false)
	@NotNull
	public boolean isSnackBar() {
		return this.snackBar;
	}

	public void setSnackBar(boolean snackBar) {
		this.snackBar = snackBar;
	}

	@Column(name = "RESTAURANT", nullable = false)
	@NotNull
	public boolean isRestaurant() {
		return this.restaurant;
	}

	public void setRestaurant(boolean restaurant) {
		this.restaurant = restaurant;
	}
	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "facility")
	public Set<Course> getCourses() {
		return this.courses;
	}

	public void setCourses(Set<Course> courses) {
		this.courses = courses;
	}

	@Lob
	@Column(name = "logo_data")
	@Basic(fetch = FetchType.LAZY)
	public byte[] getLogo() {
		return logo;
	}

	public void setLogo(byte[] logo) {
		this.logo = logo;
	}

	@Column(name = "logo_content_data")
	public String getLogoContentType() {
		return logoContentType;
	}

	public void setLogoContentType(String logoContentType) {
		this.logoContentType = logoContentType;
	}
}
